package com.youlu.campus.entity;

import com.youlu.campus.base.base.EntityBase;
import lombok.Getter;
import lombok.Setter;
import org.springframework.data.annotation.Transient;
import org.springframework.data.mongodb.core.index.Indexed;
import org.springframework.data.mongodb.core.mapping.Document;

import java.util.List;

/**
 * 合单配置
 */
@Getter
@Setter
@Document(collection = "single_order_config")
public class SingleOrderConfig extends EntityBase {
    @Indexed
    private String activityId;
    private String activityName;
    /**
     * 显示值
     */
    private String value;
    /**
     * 组合数量
     */
    private Integer num;
    /**
     * 优先级
     */
    private Integer priority;
    /**
     * 配置明细
     */
    @Transient
    private List<SingleOrderConfigDetail> details;

    @Override
    public boolean equals(Object o) {
        //自反性
        if (this == o) {
            return true;
            //任何对象不等于null，比较是否为同一类型
        }
        if (!(o instanceof SingleOrderConfig)) {
            return false;
        }
        //强制类型转换
        SingleOrderConfig config = (SingleOrderConfig) o;
        //比较属性值
        return getId() == config.getId();
    }
}
